package edu.cmu.cs.erl.unitTests;

import java.util.List;

import jp.ac.kobe_u.cs.prolog.lang.JavaObjectTerm;
import jp.ac.kobe_u.cs.prolog.lang.Term;

import org.junit.Assert;
import org.junit.Test;

import edu.cmu.cs.erl.ERL;
import edu.cmu.cs.erl.ERLError;
import edu.cmu.cs.erl.ERLException;
import edu.cmu.cs.erl.Oracle;
import edu.cmu.cs.erl.TermBuilder;


public class ImpliesTest {
	@Test
	public void trueTest() throws ERLException {
		Oracle oracle = new TestOracle();
		Term impliesTerm = TermBuilder.createImpliesTerm(TermBuilder.createAtomicTerm("a"), TermBuilder.createAtomicTerm("a"));
		
		List<ERLError> errors = ERL.runPredicate(oracle, impliesTerm, true);
		
		Assert.assertTrue(errors.isEmpty());
	}
	
	@Test
	public void trueTest2() throws ERLException {
		Oracle oracle = new TestOracle();
		Term impliesTerm = TermBuilder.createImpliesTerm(TermBuilder.createAtomicTerm("b"), TermBuilder.createAtomicTerm("b"));
		
		List<ERLError> errors = ERL.runPredicate(oracle, impliesTerm, true);
		
		Assert.assertTrue(errors.isEmpty());
	}
	
	@Test
	public void falseTest() throws ERLException {
		Oracle oracle = new TestOracle();
		Term impliesTerm = TermBuilder.createImpliesTerm(TermBuilder.createAtomicTerm("a"), TermBuilder.createAtomicTerm("b"));
		
		List<ERLError> errors = ERL.runPredicate(oracle, impliesTerm, true);
		
		Assert.assertEquals(errors.size(), 1);
	}
}